package o;

import android.util.Log;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;

public final class aat {
    private static final b<Object> ॱ = new b<Object>() {
        public void ˎ(@NonNull Object obj) {
        }
    };

    public interface b<T> {
        void ˎ(@NonNull T t);
    }

    public interface a<T> {
        T ॱ();
    }

    public interface d {
        @NonNull
        abb ˏ();
    }

    static final class e<T> implements o.hg.e<T> {
        private final a<T> ˊ;
        private final b<T> ˋ;
        private final o.hg.e<T> ˏ;

        e(@NonNull o.hg.e<T> eVar, @NonNull a<T> aVar, @NonNull b<T> bVar) {
            this.ˏ = eVar;
            this.ˊ = aVar;
            this.ˋ = bVar;
        }

        public T ˎ() {
            T ˎ = this.ˏ.ˎ();
            if (ˎ == null) {
                ˎ = this.ˊ.ॱ();
                if (Log.isLoggable("FactoryPools", 2)) {
                    Log.v("FactoryPools", "Created new " + ˎ.getClass());
                }
            }
            if (ˎ instanceof d) {
                ((d) ˎ).ˏ().ˋ(false);
            }
            return ˎ;
        }

        public boolean ˋ(@NonNull T t) {
            if (t instanceof d) {
                ((d) t).ˏ().ˋ(true);
            }
            this.ˋ.ˎ(t);
            return this.ˏ.ˋ(t);
        }
    }

    @NonNull
    public static <T extends d> o.hg.e<T> ॱ(int i, @NonNull a<T> aVar) {
        return ˎ(new o.hg.b(i), aVar);
    }

    @NonNull
    public static <T> o.hg.e<List<T>> ˏ() {
        return ˊ(20);
    }

    @NonNull
    public static <T> o.hg.e<List<T>> ˊ(int i) {
        return ˊ(new o.hg.b(i), new a<List<T>>() {
            @NonNull
            public /* synthetic */ Object ॱ() {
                return ˊ();
            }

            @NonNull
            public List<T> ˊ() {
                return new ArrayList();
            }
        }, new b<List<T>>() {
            public /* synthetic */ void ˎ(@NonNull Object obj) {
                ˊ((List) obj);
            }

            public void ˊ(@NonNull List<T> list) {
                list.clear();
            }
        });
    }

    @NonNull
    private static <T extends d> o.hg.e<T> ˎ(@NonNull o.hg.e<T> eVar, @NonNull a<T> aVar) {
        return ˊ(eVar, aVar, ˊ());
    }

    @NonNull
    private static <T> o.hg.e<T> ˊ(@NonNull o.hg.e<T> eVar, @NonNull a<T> aVar, @NonNull b<T> bVar) {
        return new e(eVar, aVar, bVar);
    }

    @NonNull
    private static <T> b<T> ˊ() {
        return ॱ;
    }
}
